/* 
 * File:   Shader.cpp
 * Author: brady
 * 
 * Created on February 8, 2011, 10:51 AM
 */

#include "Shader.h"

Shader::Shader() {}
Shader::Shader(const Shader& orig)
{
    this->Color = orig.Color;
    this->recursionDepth = orig.recursionDepth;
}
Shader::~Shader() {}

Vector3D Shader::Mix(Vector3D c1, Vector3D c2)
{
    return Vector3D(c1[0] * c2[0], c1[1] * c2[1], c1[2] * c2[2]);
}

double Shader::Magnitude(Vector3D v)
{
    return sqrt(
            v[0] * v[0] +
            v[1] * v[1] +
            v[2] * v[2]
            );
}

Vector3D& Shader::Cap(Vector3D& color, double value)
{
    double r, g, b;
    r = color[0];
    g = color[1];
    b = color[2];
    if(r > value) r = value;
    if(g > value) g = value;
    if(b > value) b = value;
    color.set(r, g, b);
    return color;
}